<?php
// 本文档自动生成，仅供测试运行
class IndexAction extends ColorBabyCommonAction
{


	public function index(){
		if(!Session::is_set(C('USER_AUTH_KEY'))){
			$msg="用户没有登录";
		}
		else{
			$msg=Session::get(C('USER_AUTH_KEY')).'欢迎你回来';
		}
		//获取新闻列表
		$this->getCommonQueryPage('xwgg','viewbulletin','_news', 0,1);
		//获取视频列表
		$this->getCommonQueryPage('jcsp','viewbulletin','_video', 0,1);
		//获取家长评价列表
		
		//$this->getCommonBlogQuery('jzpj_sy','blog',0);
		
		
		$jzpj_condition['type']='appraise';
		
		$this->assign('pjlist',$this->CommonSimplequery($jzpj_condition,'blog',0,'0,2'));
		
		
		//大图显示
		$this->publishIndexQuery('viewbulletin','_publish_middle',1,4);
		//底部小图显示
		$this->publishIndexQuery('blog','_publish_bottem',0,0);
		$this->assign('msg',$msg);
		
		$conditon['code'] = "sy" ;
		$moduleInfo = $this->CommonSimplequery($conditon,'module',1) ;
		$this->assign("moduleInfo",$moduleInfo);
		
		$this->display() ;
	}

	private function publishIndexQuery($table,$list_prefix,$publishindex=0,$pagecount){
		$Dao = M($table);
		$list ;
		if($publishindex==1){
			if($pagecount!=0){
				$list = $Dao->where('status = 1 and publishindex = ' . '"' . $publishindex . '"' )->order('createdate desc')->limit('0,'.$pagecount)->select();	
			}else{
				$list = $Dao->where('status = 1 and publishindex = ' . '"' . $publishindex . '"' )->order('createdate desc')->select();
			}				
		}else{
			if($pagecount!=0){
				$list = $Dao->where("status = 1 and imageurl <> '" . "'" )->order('createdate desc')->limit('0,'.$pagecount)->select();	
			}else{
				$list = $Dao->where("status = 1 and imageurl <> '" . "'" )->order('createdate desc')->select();
			}
			
		}
		$this->assign('list_info'.$list_prefix, $list);
	}



	/**
	 +----------------------------------------------------------
	 * 默认操作
	 +----------------------------------------------------------
	 */
	/*
	 public function index()
	 {
	 $this->display(THINK_PATH.'/Tpl/Autoindex/hello.html');
	 }
	 */
	/**
	 +----------------------------------------------------------
	 * 探针模式
	 +----------------------------------------------------------
	 */
	public function checkEnv()
	{
		load('pointer',THINK_PATH.'/Tpl/Autoindex');//载入探针函数
		$env_table = check_env();//根据当前函数获取当前环境
		echo $env_table;
	}

}
?>